<template>
  <div class="toTop" @click="toTop" v-show="show">
    <mu-icon value="publish"/>
  </div>
</template>
<script type="text/javascript">
 import $ from 'webpack-zepto'
 export default{
   name: 'toTop',
   props: ['page'],
   components: {
     // 局部自定义组件
   },
   filters: {
     // 局部自定义过滤器
   },
   data(){
     return {
       show   : false,
       target : null
     }
   },
   mounted(){
     this.target = window
     $(this.target).on('scroll', () => {
       if($(this.target).scrollTop() > 200){
         this.show = true
       }else{
         this.show = false
       }
     })
   },
   methods: {
     toTop(){
       $(this.target).scrollTop(0)
       this.show = false
       return false
     }
   },
   watch:{

   }
 }
</script>
<style scoped lang="less">
	.toTop{
		width: 50px;
		height: 50px;
		background: rgba(3,169,255,.8);
		position: fixed;
		bottom: 40px;
		right: 40px;
		border-radius: 100%;
		color: #fff;
		text-align: center;
		line-height: 78px;
		z-index: 5555;
		.mu-icon{
			font-size: 40px;
		}
	}
</style>
